﻿using UnityEngine;
namespace Share
{
    public abstract class SingletonScriptableObject<T> : ScriptableObject where T : ScriptableObject
    {
        private static T _instance;

        public static T Instance
        {
            get
            {
                if (_instance == null)
                {
                    // 路径约定：Config/[类名]
                    string path = $"Config/{typeof(T).Name}";
                    _instance = ResourceLoader.Instance.LoadAsset<T>(path);
                    if (_instance == null)
                        XKLog.LogError($"没有[{path}]这个配置文件");
                }
                return _instance;
            }
        }
    }
}